package stool.strategy;

import java.math.BigDecimal;

/**
 * @author Felix YF Dong
 * @date 2021/5/2
 * @description 消费返利子类
 */
public class CashReturn extends CashSuper{

    private BigDecimal condition = BigDecimal.ZERO;
    private BigDecimal cashReturn = BigDecimal.ZERO;

    public CashReturn (BigDecimal condition, BigDecimal cashReturn) {
        this.condition = condition;
        this.cashReturn = cashReturn;
    }

    @Override
    public Object acceptCash(BigDecimal money) {

        if (money.compareTo(condition) >= 0) {
            return money.subtract(money);
        }
        return money;
    }
}
